function base(x) {
	var li = x.parentNode.getElementsByTagName("li");
	var div = document.getElementsByTagName("div");
	// if(x.parentNode.id == "base"){alert(x.parentNode.id);}
	// alert(x.parentNode.id);
	var j, l;
	if (x.parentNode.id == "base") {
		l = 1;
	} else if (x.parentNode.id == "app") {
		l = 5;
	} else if (x.parentNode.id == "monitor") {
		l = 9;
	} else if (x.parentNode.id == "verify") {
		l = 17;
	}
	for (i = 0; i < li.length; i++) {
		if (x == li[i]) {
			j = i;
			div[i + l].className = "dis";
			// session.setAttribute("location", i+l);
		}
	}
	for (k = 0; k < 20; k++) {
		if (k != j + l) {
			div[k].className = "udis";
		}
	}
	// alert("第"+0 +"个:"+ ct[0].className);
	// location.reload();/TaxiManagerServer/home/baseInfo.jsp
}
function deleteDriver() {
	var select = document.getElementsByName("driverSelected");
	var tableId = document.getElementById("driverTable");
	var index = 0;
	var uri = "/TaxiManagerServer/DriverServlet?method=deleteDriver&";

	var con = confirm("确定要删除吗?"); // 在页面上弹出对话框
	if (con == true) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += index;
				uri += "=";
				uri += tableId.rows[i + 1].cells[2].innerHTML;
				uri += "&";
				index++;
			}
		}
		location.href = uri;
	}
	// alert(id);
}
function editDriver() {
	var select = document.getElementsByName("driverSelected");
	var tableId = document.getElementById("driverTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/DriverServlet?method=editDriver&id=";
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[2].innerHTML;
			}
		}
		location.href = uri;
	} else {
		alert("请选择一项进行修改！！");
	}
}

function editTaxi() {
	var select = document.getElementsByName("taxiSelected");
	var tableId = document.getElementById("taxiTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/TaxiServlet?method=editTaxi&license=";//
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[0].innerHTML;
			}
		}
		location.href = uri;
	} else {
		alert("请选择一项进行修改！！");
	}
}
function deleteTaxi() {
	var select = document.getElementsByName("taxiSelected");
	var tableId = document.getElementById("taxiTable");
	var index = 0;
	var uri = "/TaxiManagerServer/TaxiServlet?method=deleteTaxi&";

	var con = confirm("确定要删除吗?"); // 在页面上弹出对话框
	if (con == true) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += index;
				uri += "=";
				uri += tableId.rows[i + 1].cells[0].innerHTML;
				uri += "&";
				index++;
			}
		}
		location.href = uri;
	}
	// alert(id);
}
function editCompany() {
	var select = document.getElementsByName("companySelected");
	var tableId = document.getElementById("companyTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/CompanyServlet?method=editCompany&companyId=";//
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[0].innerHTML;
			}
		}
		location.href = uri;
	} else {
		alert("请选择一项进行修改！！");
	}
}
function deleteCompany() {
	var select = document.getElementsByName("companySelected");
	var tableId = document.getElementById("companyTable");
	var index = 0;
	var uri = "/TaxiManagerServer/CompanyServlet?method=deleteCompany&";

	var con = confirm("确定要删除吗?"); // 在页面上弹出对话框
	if (con == true) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += index;
				uri += "=";
				uri += tableId.rows[i + 1].cells[0].innerHTML;
				uri += "&";
				index++;
			}
		}
		location.href = uri;
	}
	// alert(id);
}
function editFare() {
	var select = document.getElementsByName("fareSelected");
	var tableId = document.getElementById("fareTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/FareServlet?method=editFare&updateTime=";//
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[20].innerHTML;
			}
		}
		location.href = uri;
	} else {
		alert("请选择一项进行修改！！");
	}
}
function deleteFare() {
	var select = document.getElementsByName("fareSelected");
	var tableId = document.getElementById("fareTable");
	var index = 0;
	var uri = "/TaxiManagerServer/FareServlet?method=deleteFare&";

	var con = confirm("确定要删除吗?"); // 在页面上弹出对话框
	if (con == true) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += index;
				uri += "=";
				uri += tableId.rows[i + 1].cells[19].innerHTML;
				uri += "&";
				index++;
			}
		}
		location.href = uri;
	}
	// alert(id);
}

function queryCheatMonitor() {
	var select = document.getElementsByName("transactionSelected");
	var tableId = document.getElementById("transactionTable");
	var index = 0;
	var uri = "/TaxiManagerServer/OperationQueryServlet?method=queryCheatMonitor&license=";
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {// 选中的个数
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				if(tableId.rows[i + 1].cells[16].innerHTML == "无记录") {
					alert("无记录");
				} else {
					uri += encodeURI(tableId.rows[i + 1].cells[0].innerHTML);
					//uri += tableId.rows[i + 1].cells[0].innerHTML;
					uri = uri + "&getOnTime=" + tableId.rows[i + 1].cells[3].innerHTML;
				}
			}
		}//alert(uri);
		location.href = uri;
	} else {
		alert("请选择一项进行查询！！");
	}
}
function queryVerifyTrace() {
	var select = document.getElementsByName("carMeasureSelected");
	var tableId = document.getElementById("carMeasureTable");
	var index = 0;
	var uri = "/TaxiManagerServer/VerifyAdjustServlet?method=queryVerifyTrace&verifyTime=";
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {// 选中的个数
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[15].innerHTML;
			}
		}alert(uri);
		location.href = uri;
	} else {
		alert("请选择一项进行查询！！");
	}
}
function editStandardRoute() {
	var select = document.getElementsByName("standardRouteSelected");
	var tableId = document.getElementById("StandardRouteTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/VerifyAdjustServlet?method=editStandardRoute&num=";
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {// 选中的个数
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += tableId.rows[i + 1].cells[0].innerHTML;
			}
		}
		location.href = uri;
	} else {
		alert("请选择一项进行修改！！");
	}
}
function deleteStandardRoute() {
	var select = document.getElementsByName("standardRouteSelected");
	var tableId = document.getElementById("StandardRouteTable");
	var index = 0;
	var uri = "/TaxiManagerServer/VerifyAdjustServlet?method=deleteStandardRoute&";

	var con = confirm("确定要删除吗?"); // 在页面上弹出对话框
	if (con == true) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				uri += index;
				uri += "=";
				uri += tableId.rows[i + 1].cells[0].innerHTML;
				uri += "&";
				index++;
			}
		}
		location.href = uri;
	}
	// alert(id);
}
//发送标准路线到终端
function sendToISU() {
	var select = document.getElementsByName("standardRouteSelected");
	var tableId = document.getElementById("StandardRouteTable");//
	var index = 0;
	var uri = "/TaxiManagerServer/VerifyAdjustServlet?method=sendToISU&num=";
	var selectNum = new Array();
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;//选中的个数
			selectNum.push(tableId.rows[i + 1].cells[0].innerHTML);
		}
	}
	if (index >= 1) {//可以选多条路线，至少选择一条
		var con = confirm("确定要发送编号为 :" + selectNum.toString() + "的路线?"); //在页面上弹出对话框
		if (con == true) {
			uri += selectNum.toString();
			location.href = uri;
		}
	} else {
		alert("请选择一条路线进行校准！！");
	}
}
function queryDetail() {
	var queryLocationRunStateDetailForm = document.getElementById("queryLocationRunStateDetailForm");
	var select = document.getElementsByName("locationRunStateSelected");
	var tableId = document.getElementById("locationRunStateTable");
	var index = 0;
	var license = document.createElement("input"); // 创建input节点
	license.name = "license";
	license.type = "hidden";
	for (i = 0; i < select.length; i++) {
		if (select[i].checked == true) {
			index++;
		}
	}
	if (index == 1) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				license.value = tableId.rows[i + 1].cells[1].innerHTML;
				queryLocationRunStateDetailForm.appendChild(license);
				queryLocationRunStateDetailForm.submit();
			}
		}
	} else {
		alert("请选择一项进行查询！！");
	}
}
function traceReplay() {
	var traceReplayForm = document.getElementById("traceReplayForm");
	var select = document.getElementsByName("traceReplaySelected");
	var tableId = document.getElementById("locationRunStateTable");
	var index = 0;
	var license = document.createElement("input"); // 创建input节点
	license.name = "license";
	license.type = "hidden";
	if ((document.traceReplayFormName.traceTimeBegin.value != "")
			&& (document.traceReplayFormName.traceTimeEnd.value != "")) {
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				index++;
			}
		}
		if (index == 1) {
			for (i = 0; i < select.length; i++) {
				if (select[i].checked == true) {
					license.value = tableId.rows[i + 1].cells[1].innerHTML;
					traceReplayForm.appendChild(license);
					traceReplayForm.submit();
				}
			}
		} else {
			alert("请选择一项进行查询！！");
		}
	} else {
		alert("请填写完整时间！！");
	}
}
function remoteManage(sendType, msgID) {
	var remoteManageForm = document.getElementById("remoteManageForm");
	var type = document.createElement("input"); // 创建input节点，添加发送类型
	type.name = "sendType";
	type.value = sendType;
	type.type = "hidden";
	remoteManageForm.appendChild(type); // 添加到form中显示
	var content = document.createElement("input"); // 创建input节点，添加发送类型
	content.name = "msgID";
	content.value = msgID;
	content.type = "hidden";
	remoteManageForm.appendChild(content); // 添加到form中显示

	if (sendType == "all") {
		var con = confirm("确定要发送给全体成员吗?" + sendType); // 在页面上弹出对话框
		if (con == true) {
			remoteManageForm.submit();
		}
		// alert(msgID.value);
	} else if (sendType == "part") {

		var select = document.getElementsByName("remoteManageTaxi");
		var tableId = document.getElementById("remoteManageTaxiTable");
		var index = 0;
		for (i = 0; i < select.length; i++) {
			if (select[i].checked == true) {
				var license = document.createElement("input"); // 创建input节
				license.name = index;
				license.value = tableId.rows[i + 1].cells[0].innerHTML;
				license.type = "hidden";
				remoteManageForm.appendChild(license);
				index++;
			}
		}
		if (index == 0) {
			alert("请先选择要发送的成员！");
		} else {
			remoteManageForm.submit();
		}
	}
}
function sendMSg(sendType, location) {
	var messageArea = document.getElementById("messageArea").value;

	if (messageArea == null) {
		alert("发送的消息不能为空");
	} else {
		var messageForm = document.getElementById("messageForm");

		var msgID = document.createElement("input"); // 创建input节点，添加msgId
		msgID.name = "msgID";
		msgID.value = 109;
		msgID.type = "hidden";
		messageForm.appendChild(msgID); // 添加到form中显示

		var type = document.createElement("input"); // 创建input节点，添加发送类型
		type.name = "sendType";
		type.value = sendType;
		type.type = "hidden";
		messageForm.appendChild(type); // 添加到form中显示

		if (sendType == "all") {
			var con = confirm("确定要发送给全体成员吗?"); // 在页面上弹出对话框
			if (con == true) {
				messageForm.submit();
			}
			// alert(msgID.value);
		} else if (sendType == "part") {
			var select = document.getElementsByName("sendMsgSelected");
			var tableId = document.getElementById("allLicenseTable");
			var index = 0;
			for (i = 0; i < select.length; i++) {
				if (select[i].checked == true) {

					var sendLicense = document.createElement("input"); // 创建input节点
					sendLicense.name = index;
					sendLicense.value = tableId.rows[i + 1].cells[0].innerHTML;
					sendLicense.type = "hidden";
					messageForm.appendChild(sendLicense);
					index++;
				}
			}
			// alert(index);
			if (index == 0) {
				alert("请先选择要发送的成员！");
			} else {
				messageForm.submit();
			}
		}
	}

}
